package com.ps.controller;

import com.ps.property.PageBean;
import com.ps.property.ResponseVO;
import com.ps.property.ReviewQuestionVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import com.ps.service.ReviewQuestionService;

import javax.validation.Valid;

/**
 * @author gt
 * @类说明：提问审核审核
 * @date 2020/10/26 10:30
 */
@Api(tags = "提问审核接口")
@Controller
@Validated
@Slf4j
public class ProvideReviewQuestionController {
    @Autowired
    ReviewQuestionService reviewQuestionService;

    @ApiOperation(value = "新增提问审核信息接口",notes = "新增提问审核信息接口，新增提问审核")
    @PostMapping("/reviewQuestionAdd-provide")
    @ResponseBody
    ResponseVO reviewQuestionAdd(@Valid @RequestBody ReviewQuestionVo reviewQuestionVo) {
        log.info("提问审核提供者reviewQuestionVo={}", reviewQuestionVo);
        return ResponseVO.success(reviewQuestionService.reviewQuestionAdd(reviewQuestionVo));
    }

    @ApiOperation(value = "分页查询提问审核信息接口",notes = "分页查询提问审核信息接口，分页查询提问审核")
    @ApiImplicitParams({@ApiImplicitParam(name = "currentPage", value = "当前页数", required = true),@ApiImplicitParam(name = "pageSize", value = "每页行数", required = true)})
    @GetMapping("/reviewQuestionQuery-provide")
    @ResponseBody
    ResponseVO reviewQuestionQuery(@RequestParam("currentPage") int currentPage, @RequestParam("pageSize") int pageSize) {
        log.info("提问审核分页查询提供者--当前页={},每页行数={}", currentPage,pageSize);
        return ResponseVO.success(reviewQuestionService.reviewQuestionQuery(currentPage,pageSize));
    }

    @ApiOperation(value = "根据提问审核id修改提问审核信息接口",notes = "修改提问审核信息接口，修改提问审核")
    @ApiImplicitParam(name = "reviewQuestionId",value = "提问审核ID",required = true)
    @PostMapping("/reviewQuestionUpdate-provide")
    @ResponseBody
    ResponseVO reviewQuestionUpdate(@Valid @RequestBody ReviewQuestionVo reviewQuestionVo) {
        log.info("根据提问审核id修改提问审核信息提供者-reviewQuestionVo={}", reviewQuestionVo);

        return ResponseVO.success(reviewQuestionService.reviewQuestionUpdate(reviewQuestionVo));
    }

    @ApiOperation(value = "根据提问审核id查询提问审核信息接口",notes = "查询提问审核信息接口，查询提问审核")
    @ApiImplicitParam(name = "reviewQuestionId",value = "提问审核ID",required = true)
    @GetMapping("/reviewQuestionQueryById-provide/{reviewQuestionId}")
    @ResponseBody
    ResponseVO reviewQuestionQueryById(@PathVariable int reviewQuestionId) {
        log.info("根据提问审核id查询提问审核信息提供者-提问审核ID={}", reviewQuestionId);

        return ResponseVO.success(reviewQuestionService.reviewQuestionQueryById(reviewQuestionId));
    }
}
